// 类的类型定义
class Animal {
	name: string
	static categoies: string[] = ['mammal', 'bird']
	static isAnimal(a: any) {
		return a instanceof Animal
	}
	constructor(name: string) {
		this.name = name
	}
	run() {
		return `${this.name} is running`
	}
}

console.log(Animal.categoies)
const snake = new Animal('lily')
console.log(Animal.isAnimal(snake))

// const snake = new Animal('lily')
// console.log(snake.name)
// snake.name = 'lucy'
// console.log(snake.name)

// 类的继承
class Dog extends Animal {
	bark() {
		return `${this.name} is barking`
	}
}

const xiaobao = new Dog('小花')
// console.log(xiaobao.run())
// console.log(xiaobao.bark())

// 重写构造函数和方法--super
class Cat extends Animal {
	constructor(name: string) {
		super(name)
	}
	run() {
		return `喵~，` + super.run()
	}
}

const mao = new Cat('毛毛')
// console.log(mao.run())
